package com.itheima.exception;

/**
 * 继承RunTimeException类，实现所有构造方法 --> alt + insert
 *
 * 要定义一个code变量来标识产生了哪种异常
 */
public class BusinessException extends RuntimeException {

    private Integer code;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    /**
     * 只需要这两个
     * @param message
     * @param code
     */
    public BusinessException(Integer code ,String message) {
        super(message);
        this.code = code;
    }

    /**
     * 这里面的cause就是Exception e里的这个e
     * @param code
     * @param message
     * @param cause
     */
    public BusinessException(Integer code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

//    public BusinessException(Throwable cause, Integer code) {
//        super(cause);
//        this.code = code;
//    }
//
//    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Integer code) {
//        super(message, cause, enableSuppression, writableStackTrace);
//        this.code = code;
//    }
}
